package ie.dkit.semanticPhotoWeb.server.persistence.storageObjects;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * @author Sebastian Ruehl
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */
@Entity
@Table(name = "pictureRelations")
@NamedQueries( {
		@NamedQuery(name = "findLinkedPicturesById", query = "from PictureRelation p where p.firstPhotoID = ?"),
		@NamedQuery(name = "findReferringPicturesById", query = "from PictureRelation p where p.secondPhotoID = ?"),
		@NamedQuery(name = "findAllRelationsWithContainingPictureID", query = "from PictureRelation p where p.firstPhotoID = ? or p.secondPhotoID = ?") })
public class PictureRelation {

	@Id
	@GeneratedValue
	private int id;

	@Basic
	private String username;

	@Basic
	private String firstPhotoID;

	@Basic
	private String secondPhotoID;

	@Basic
	private String relationTyp;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getFirstPhotoID() {
		return firstPhotoID;
	}

	public void setFirstPhotoID(String first_PhotoID) {
		this.firstPhotoID = first_PhotoID;
	}

	public String getSecondPhotoID() {
		return secondPhotoID;
	}

	public void setSecondPhotoID(String second_PhotoID) {
		this.secondPhotoID = second_PhotoID;
	}

	public String getRelationTyp() {
		return relationTyp;
	}

	public void setRelationTyp(String relation_Typ) {
		this.relationTyp = relation_Typ;
	}
}
